package xpn.platform.common.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;

/**
 * RESTful 响应数据传输对象
 */
@Data
@AllArgsConstructor
@RequiredArgsConstructor
public class ResponseDTO {

	private final static int OK_CODE = 0;

	@NonNull
	private Integer errorCode; // 错误代码
	@NonNull
	private String message; // 响应消息
	private Object data; // 响应数据

	public ResponseDTO() {
		this.setErrorCode(OK_CODE);
		this.setMessage("");
		this.setData(null);
	}

	public ResponseDTO(String message) {
		this.setErrorCode(OK_CODE);
		this.setMessage(message);
		this.setData(null);
	}

	public ResponseDTO(Object data) {
		this.setErrorCode(OK_CODE);
		this.setMessage("");
		this.setData(data);
	}
}